package com.lb.reference;

import java.lang.ref.WeakReference;

/**
 * @version 1.0
 * @Author: Edward
 * @Date: 2021/4/15 8:54
 * @Description: 弱引用
 */
public class T03_WeakReference {
    public static void main(String[] args) {
        WeakReference<M> m = new WeakReference<>(new M());

        System.out.println(m.get());
        System.gc();
        System.out.println(m.get());

        ThreadLocal<M> tl = new ThreadLocal<>();
        tl.set(new M());
        tl.remove();

    }
}
